import { defaultTheme } from '@vuepress/theme-default'
import { shikiPlugin } from '@vuepress/plugin-shiki'
import { copyCodePlugin } from "vuepress-plugin-copy-code2"
import { readFileSync } from 'fs'
import { baiduAnalyticPlugin } from './plugins/baidu-analytic'

import { zhCNLocale } from './locale/zh-CN'
import { enUSLocale } from './locale/en-US'

console.log(process.cwd());
export default {
  plugins: [
    copyCodePlugin(),
    baiduAnalyticPlugin({
      hm: '58c0b6e6817923dd3d7aca3bd4509b71',
      ignoreLocal: true,
    }),
    shikiPlugin({
      theme: 'dark-plus',
      langs: [
        'c', 'cpp', 'shell', 'python', 'go', 'rust', 'java', 'makefile', 'markdown', 'md',
        {
          "id": "arch-keywords",
          "scopeName": "source.arch-keywords",
          "grammar": JSON.parse(readFileSync("res/tmLanguages/arch-keywords.tmLanguage.json"))
        },
        {
          "id": "rpmspec",
          "scopeName": "source.spec",
          "grammar": JSON.parse(readFileSync("res/tmLanguages/rpmspec.tmLanguage.json"))
        }
      ]
    }),
  ],
  locales: {
    // The key is the path for the locale to be nested under.
    // As a special case, the default locale can use '/' as its path.
    '/': {
      lang: 'zh-CN',
      title: 'RISC-V 架构适配知识库',
      description: 'RISC-V 架构适配知识库',
    },
    '/en-US/': {
      lang: 'en-US',
      title: 'RISC-V Porting Wiki',
      description: 'RISC-V Porting Wiki',
    },
  },
  theme: defaultTheme({
    locales: {
      '/': zhCNLocale,
      '/en-US/': enUSLocale,
    },
  }),
}
